package online.chazi.bootplus.commons.utils;

import io.leopard.javahost.JavaHost;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PropertiesLoaderUtils;

import java.util.Properties;

/**
 * 说明：作者很懒，什么都没留下
 * Created by 叉子同学 on 2020-04-28 10:22
 */
@Slf4j
public class HostUtils {

    public static void updateHosts() {
        try {
            Resource resource = new ClassPathResource("/hosts");
            Properties props = PropertiesLoaderUtils.loadProperties(resource);
            JavaHost.updateVirtualDns(props);
        } catch (Exception e) {
            log.error(e.getMessage(), e);
        }
    }

}
